package main

import (
	"fmt"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"

	_ "github.com/go-sql-driver/mysql"

	_ "priceApi/routers"
	_ "priceApi/spider"
)

func init() {
	orm.RegisterDriver("mysql", orm.DRMySQL)
	mysqluser := beego.AppConfig.String("mysqluser")

	mysqlpass := beego.AppConfig.String("mysqlpass")
	mysqldb := beego.AppConfig.String("mysqldb")
	mysqlhost := fmt.Sprint(beego.AppConfig.String("mysqlurl"), ":", beego.AppConfig.String("mysqlport"))
	orm.RegisterDataBase("default", "mysql", mysqluser+":"+mysqlpass+"@tcp("+mysqlhost+")/"+mysqldb+"?charset=utf8")
	beego.SetLogger("file", `{"filename":"log/log.log"}`)
	//beego.BeeLogger.DelLogger("console")
	if beego.BConfig.RunMode != "dev" {
		beego.BeeLogger.DelLogger("console")
	}
}
func main() {
	beego.Run()
}
